import request from "../utils/request";
//登录接口
const Login = () => {
    return request({
        url:"/login",
        method:"post",
        data:{
            account:"xiaotuxian001",
            password:"123456"
        }
    })
}
// 首页所有数据
const getss = () => {
    return request({
        url: '/home/index',
    })
}

//导航条数据
const categoryList = () => {
    return request({
        url: '/home/category/head',
        method: 'get',
        params:{}
    })
}
//导航所有数据All
const categoryAllList = (id) => {
    return request({
        url: '/category',
        method: 'get',
        params: {
            id
        }
    })
}
// 新鲜好物
const freshGoods = () => {
    return request({
        url: '/home/new',
        method: 'get',
    })
}
// 人气推荐
const hotRecommends = () => {
    return request({
        url: '/home/hot',
        method: 'get',
    })
}
// 热门品牌
const hotBrands = () => {
    return request({
        url:"home/brand",
        method: 'get'
    })
}
// 最新专题
const special = () => {
    return request({
        url:"/home/special",
        method:'get'
    })
}
// 产品区块
const goodsData = () => {
    return request({
        url:"/home/goods",
        method:'get'
    })
}
// 详情页数据
const a = (id) => {
    return request({
        url:"/goods",
        method:'get',
        params:{
            id,
        }
    })
}
//导航页banner数据
const bannerList = () => {
    return request({
        url: '/home/banner',
        method: 'get',
        params:{}
    })
}

/* 获取nav那页nav数据 */
const getNav = (num) => {
    return request({
        url:"/category/sub/filter",
        method:"get",
        params:{
            id:num
        }
    })
}
/* 点击nav元素获取数据 */
const getNavLi = (data) => {
    return request({
        url:"/category/goods/temporary",
        method:"post",
        data
    })
}

// 购物车
const getCart = () => {
    return request({
        url: '/member/cart/count',
        method: 'get',
        params: {
            
        }
    })
}
const getCartList = () => {
    return request({
        url: '/member/cart',
        method: 'get',
        params: {
            
        }
    })
}
const del = (id) => {
    return request({
        url: '/member/order',
        method: 'delete',
        data: {
            'ids':[id]
        }
    })
}
const getOrder = () => {
    return request({
        url: '/member/order/pre',
        method: 'get',
        data: {
            page:'1',
            pageSize:"10",
        }
    })
}
const getAddress = () => {
    return request({
        url: '/member/address',
        method: 'get',
        data: {
            
        }
    })
}

export default {
    categoryList,
    categoryAllList,
    bannerList,
    Login,
    getss,
    hotRecommends,
    freshGoods,
    hotBrands,
    special,
    goodsData,
    a,
    getNav,
    getNavLi,
    getCart,
    getCartList,
    del,
    getOrder,
    getAddress,
}